﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using STT.Layer.Connection;
using System.Data;

namespace STT.Home
{
    public partial class UcGioiThieu : System.Web.UI.UserControl
    {
        ToolBox tb = new ToolBox();
        protected void Page_Load(object sender, EventArgs e)
        {
            DataTable dt = tb.GetDataTableById("TbTinTuc_GetByLoaiTT", "5");
            dllgioithieu.DataSource = dt;
            dllgioithieu.DataBind();
            lblctgioithieu.Visible = false;
        }


        protected void dllgioithieu_ItemCommand(object source, DataListCommandEventArgs e)
        {
            if (e.CommandName == "ChiTiet")
            {
                lblctgioithieu.Visible = true;
                lbltieude.Visible = true;
                lbltomtat.Visible = true;
                string id = dllgioithieu.DataKeys[e.Item.ItemIndex].ToString();
                DataTable dt2 = tb.GetDataTableById2("Get_TinTuc_ById", id);
                lbltieude.Text = HttpUtility.HtmlDecode((string)(dt2.Rows[0]["Tieude"].ToString()));
                lbltomtat.Text = HttpUtility.HtmlDecode((string)(dt2.Rows[0]["NDTomTat"].ToString()));
                lblctgioithieu.Text = HttpUtility.HtmlDecode((string)(dt2.Rows[0]["NDChiTiet"].ToString()));
            }
        }
    }
}